package org.onvivals.admin.module.ums.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.onvivals.common.param.PageParam;
import org.onvivals.common.web.PageResult;
import org.onvivals.common.web.Result;
import org.onvivals.module.ums.entity.UmsUserRecharge;
import org.onvivals.module.ums.param.UmsUserRechargeParam;
import org.onvivals.module.ums.service.IUmsUserRechargeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * @Author: Mr.ZS
 * @Date: 2024/2/20 15:20
 * @company 湖南葆龄科技有限公司
 **/
@Slf4j
@RestController
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@RequestMapping("/userRecharge")
public class UserRechargeController {

	private final IUmsUserRechargeService memberRechargeService;

	@GetMapping
	public Result<PageResult<UmsUserRecharge>> getYxUserRecharges(UmsUserRechargeParam param) {
		PageParam<UmsUserRecharge, UmsUserRechargeParam> page = new PageParam<>(param);
		page.setDefaultOrder("create_time desc");
		IPage<UmsUserRecharge> pa = memberRechargeService.page(page, page.getWrapper());
		PageResult<UmsUserRecharge> pageResult = new PageResult<>(pa.getRecords(), pa.getTotal());
		return Result.OK(pageResult);
	}

}
